package com.light.sys.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.light.common.mybatisplus.MybatisPlusHelper;
import com.light.common.base.BaseServiceImpl;

import java.io.Serializable;
import java.util.List;

import com.light.sys.query.SysMenuQuery;
import com.light.sys.mapper.SysMenuMapper;
import com.light.sys.domain.SysMenuDO;
import com.light.sys.service.SysMenuService;



@Service
public class SysMenuServiceImpl extends BaseServiceImpl<SysMenuDO, SysMenuMapper> implements SysMenuService {
	@Autowired
	private SysMenuMapper sysMenuMapper;

	@Override
	public List<SysMenuDO> selectChildrens(Long id) {
		return sysMenuMapper.selectList(new QueryWrapper<SysMenuDO>().eq("parent_id", id));
	}

	@Override
	public List<SysMenuDO> data(SysMenuQuery sysMenuQuery){
		QueryWrapper<SysMenuDO> queryWrapper = MybatisPlusHelper.setQueryWrapperPageParam(sysMenuQuery.createQueryWrapper(),sysMenuQuery);
		return sysMenuMapper.selectList(queryWrapper);
	}
	
	@Override
	public int count(SysMenuQuery sysMenuQuery){
		return sysMenuMapper.selectCount(sysMenuQuery.createQueryWrapper());
	}
	

}
